Skip to content

getCSVForFileId

Description

Retrieves a raw CSV string and parsed object array for a given CSV file id.

Syntax

VabletNativeInterface.callNativeMethod('getCSVForFileId', {fileId: 123}, (res)=>{...})

Options

Key Type Description
fileId int fileId of the CSV file to be parsed.

Response

Key Type Description
success boolean Returns true on success and false for any errors.
error string Error message, provided there is one.
csvString string A string containing the raw CSV data.
parsedCSV object A parsed object from the CSV data. Uses the first row for key names.

Example

VabletNativeInterface.callNativeMethod(
  'getCSVForFileId',
  {fileId: 123},
  (res)=>{
    if (res.success) {
      // Success! Extract values from response
      const {csvString, parsedCSV} = res;

      // Do something!
      alert("Raw CSV Data", csvString);
      alert("Parsed CSV Object", parsedCSV);
    } else {
      // Uh oh, let's alert the error!
      alert(res.error)
    }
  }
);